package io.kiki.sba.registry.server.clientInterface.remoting.console.handler;

import io.kiki.sba.registry.api.Channel;
import io.kiki.sba.registry.common.model.GenericResponse;
import io.kiki.sba.registry.common.model.sessionserver.FilterSubscriberIPsRequest;
import io.kiki.sba.registry.server.clientInterface.store.Subscribers;
import org.springframework.beans.factory.annotation.Autowired;

public class FilterSubscriberIPsHandler extends AbstractConsoleHandler<FilterSubscriberIPsRequest> {
    @Autowired
    protected Subscribers sessionSubscribers;

    @Override
    public Class interest() {
        return FilterSubscriberIPsRequest.class;
    }

    @Override
    public Object doHandle(Channel channel, FilterSubscriberIPsRequest request) {
        return new GenericResponse().fillSucceed(sessionSubscribers.filterIPs(request.getGroup(), request.getIpLimit()));
    }
}
